@import 'framework/variables';

.gitlab-embed-snippets {
  @import 'highlight/embedded';
  @import 'framework/images';

  $border-style: 1px solid $border-color;

  font-family: $regular-font;
  font-size: $gl-font-size;
  line-height: $code-line-height;
  color: $gl-text-color;
  margin: 20px;
  font-weight: $gl-font-weight-normal;

  .gl-snippet-icon {
    display: inline-block;
    /* stylelint-disable-next-line function-url-quotes */
    background: url(asset_path('ext_snippet_icons/ext_snippet_icons.png')) no-repeat;
    overflow: hidden;
    text-align: left;
    width: 16px;
    height: 16px;
    background-size: cover;

    &.gl-snippet-icon-doc-code { background-position: 0 0;  }
    &.gl-snippet-icon-doc-text {  background-position: 0 -16px; }
    &.gl-snippet-icon-download {  background-position: 0 -32px; }
    &.gl-snippet-icon-copy-to-clipboard {  background-position: 0 -48px; }
  }

  .blob-viewer {
    background-color: $white;
    text-align: left;
  }

  .file-holder {
    margin: 0;
  }

  .file-content.code {
    border: $border-style;
    border-radius: 0 0 $border-radius-default $border-radius-default;
    display: flex;
    box-shadow: none;
    margin: 0;
    padding: 0;
    table-layout: fixed;
    overflow-x: auto;

    .blob-content {
      pre {
        padding: 10px;
        border: 0;
        border-radius: 0;
        margin: 0;
        overflow: auto;
        overflow-y: hidden;
        white-space: pre;
        word-wrap: normal;
        border-left: $border-style;
        text-size-adjust: 100%;
        -webkit-text-size-adjust: 100%; /* stylelint-disable-line property-no-vendor-prefix */
      }

      code {
        font-family: $monospace-font;
        font-size: $code-font-size;
        line-height: $code-line-height;
        display: inline-block;
      }
    }

    .line-numbers {
      padding: 10px 10px 10px 0;
      text-align: right;
      float: left;

      .diff-line-num {
        font-family: $monospace-font;
        display: block;
        font-size: $code-font-size;
        line-height: $code-line-height;
        white-space: nowrap;
        color: $black-transparent;
        min-width: 30px;
      }

      .diff-line-num:hover {
        color: $almost-black;
        cursor: pointer;
      }
    }
  }

  .file-actions {
    flex-shrink: 0;
  }

  .file-title-flex-parent {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background-color: $gray-light;
    border: $border-style;
    border-bottom: 0;
    padding: $gl-padding;
    margin: 0;
    border-radius: $border-radius-default $border-radius-default 0 0;

    .file-header-content {
      max-width: 75%;
      align-self: center;

      .file-title-name {
        font-weight: $gl-font-weight-bold;
      }

      .gitlab-embedded-snippets-title {
        text-decoration: none;
        color: $gl-text-color;
        word-break: break-word;

        &:hover {
          text-decoration: underline;
        }
      }

      .gitlab-logo-wrapper {
        padding-left: $gl-padding-8;
        position: relative;
        top: 2px;

        .gitlab-logo {
          height: 18px;
        }
      }
    }

    img,
    .gl-snippet-icon {
      display: inline-block;
      vertical-align: text-bottom;
    }
  }

  .btn-group {
    position: relative;
    display: inline-flex;
    vertical-align: middle;

    button.btn,
    a.btn {
      background-color: $white;
      text-decoration: none;
      padding: 8px 9px;
      border: $border-style;
      border-right: 0;

      &:hover {
        background-color: $white-normal;
        border-color: $border-white-normal;
        text-decoration: none;
      }

      &:first-child {
        border-radius: $border-radius-default 0 0 $border-radius-default;
      }

      &:last-child {
        border-radius: 0 $border-radius-default $border-radius-default 0;
        border-right: $border-style;
      }
    }

    button.btn {
      padding: 9px 9px 8px;
    }
  }
}
